MutableSet

interface MutableSet<E> : Set<E> , MutableCollection<E>

A generic unordered collection of elements that does not support duplicate elements, and supports adding and removing elements.

Parameters

E

the type of elements contained in the set. The mutable set is invariant in its element type.

Functions

add
Link copied to clipboard
abstract override fun add(element: E): Boolean

Adds the specified element to the set.

addAll
Link copied to clipboard
abstract override fun addAll(elements: Collection<E>): Boolean

Adds all of the elements of the specified collection to this collection.

clear
Link copied to clipboard
abstract override fun clear()

Removes all elements from this collection.

contains
Link copied to clipboard
abstract operator override fun contains(element: E): Boolean

Checks if the specified element is contained in this collection.

containsAll
Link copied to clipboard
abstract override fun containsAll(elements: Collection<E>): Boolean

Checks if all elements in the specified collection are contained in this collection.

isEmpty
Link copied to clipboard
abstract override fun isEmpty(): Boolean

Returns true if the collection is empty (contains no elements), false otherwise.

iterator
Link copied to clipboard
abstract operator override fun iterator(): MutableIterator<E>

Returns an iterator over the elements of this object.

remove
Link copied to clipboard
abstract override fun remove(element: E): Boolean

Removes a single instance of the specified element from this collection, if it is present.

removeAll
Link copied to clipboard
abstract override fun removeAll(elements: Collection<E>): Boolean

Removes all of this collection's elements that are also contained in the specified collection.

retainAll
Link copied to clipboard
abstract override fun retainAll(elements: Collection<E>): Boolean

Retains only the elements in this collection that are contained in the specified collection.

Properties

size
Link copied to clipboard
abstract override val size: Int

Returns the size of the collection.

Inheritors

AbstractMutableSet
Link copied to clipboard
HashSet
Link copied to clipboard
LinkedHashSet
Link copied to clipboard